<style>
.main-user .content-user .main > .el-scrollbar > .el-scrollbar__wrap {
  overflow-x: hidden;
  overflow-y: auto;
  height: calc(100vh - 82px);
}
</style>
<style scoped>
.main-user {
  display: flex;
  flex-flow: row;
  width: 100%;
}
.main {
  width: 100%;
  height: 100%;
}
.main .content {
  padding: 24px 12px;
  margin-right: 12px;
}
.content-user{ background: #fff;}
</style>
<!--  -->
<template>
  <el-container>
    <div class="main-user">
      <el-aside width="220px">
        <LeftMenu />
      </el-aside>
      <el-main style="padding: 0">
        <div class="content-user">
          <Nav />
          <div class="main">
            <el-scrollbar ref="scrolluu">
              <div class="content">
                <router-view />
              </div>
            </el-scrollbar>
          </div>
        </div>
      </el-main>
    </div>
  </el-container>
</template>

<script>
import LeftMenu from '@/components/main/user/leftMenu/LeftMenu.vue'
import Nav from '@/components/main/user/Nav.vue'
import PubSub from 'pubsub-js'
import * as PubsubType from '@/config/pubsubtype.js'
export default {
  data () {
    return {
    }
  },
  created () {
    PubSub.subscribe(PubsubType.PUBSUB_BACKEND_MAIN_SCROLL_TOTOP, (event, top) => {
      if (top === -1) {
        this.$refs['scrolluu'].wrap.scrollTop = this.$refs['scrolluu'].wrap.scrollHeight
      } else {
        this.$refs['scrolluu'].wrap.scrollTop = top
      }
    })
  },
  components: {
    LeftMenu,
    Nav
  }
}

</script>
